﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Wechat.API.Filter;
using Wechat.Dto.Request;
using Wechat.Dto.Search;
using Wechat.Manager;
using Wechat.Util.ReturnMessage;
using Wechat.Util.StateCode;

namespace Wechat.API.Controllers
{
    /// <summary>
    /// 图文消息组
    /// </summary>
    [RoutePrefix("api/imagetextgroup"), UnUserAuthorize]
    public class ImageTextGroupController : ApiController
    {
        public IWechatImageTextGroupManager WechatImageTextGroupManager { get; set; }

        /// <summary>
        /// 添加图文消息组
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [Route("insertorupdate")]
        public ResultMessage InsertOrUpdateImageTextGroup(WechatImageTextRequest request)
        {
            ResultMessage returnMsg = new ResultMessage()
            {
                Status = false
            };
            if (ModelState.IsValid && request != null)
            {
                returnMsg = WechatImageTextGroupManager.InsertOrUpdateImageTextGroup(request);
            }
            else
            {
                returnMsg.Code = (int)EnumApiStateCode.ParameterValidationFailed;
                returnMsg.Message = "参数校验失败";
            }
            return returnMsg;
        }

    }
}
